#include "ProjectAttribForm.h"
#include "ui_ProjectAttribForm.h"
#include <QDateTime>
ProjectAttribForm::ProjectAttribForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ProjectAttribForm)
{
    ui->setupUi(this);
}

ProjectAttribForm::~ProjectAttribForm()
{
    delete ui;
}

void ProjectAttribForm::InitUiData()
{
    ui->lineEdit->setText(ModelXml::GetInstance()->GetProject().name.c_str());
    ui->lineEdit_2->setText(ModelXml::GetInstance()->GetProject().desc.c_str());
    ui->lineEdit_3->setText(ModelXml::GetInstance()->GetProject().path.c_str());
    ui->lineEdit_4->setText(ModelXml::GetInstance()->GetProject().modiTime.c_str());
}

void ProjectAttribForm::on_save_Button_clicked()
{
    ModelXml::GetInstance()->GetProject().name = ui->lineEdit->text().toStdString();
    ModelXml::GetInstance()->GetProject().desc = ui->lineEdit_2->text().toStdString();
    ModelXml::GetInstance()->GetProject().modiTime = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss").toStdString();
    ModelXml::GetInstance()->SaveXml();
}
